You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be compatible with all previous implementations, as the component have the same inputs and outputs as it used to have, and the directive has mostly the same API as the component, except for the id and tagName inputs.
Hi @javiermarinros, thanks for putting in the time to make this PR.
I think it's an interesting idea and novel. In my opinion though I think it's quite narrow in its use case.
A directive to me should be able to be used across a variety of elements, whereas this one can only be used on a textarea. The changes it makes to the textarea is quite substantial as well, giving more support to the idea that it's a full blown component and should look as such in the template it's used.
It should also be said that it does add more complexity in having a directive that the component now uses and a whole relationship there that wasn't needed before.
That's my thoughts on it for now. If others think differently or if there's significant want/need for this in the future we'll certainly consider it.
Hi @danoaky-tiny thank you for your review. Just some remarks:
It can be used with any element with [editor] attribute, not only textareas.
The relationship between the Component and the Directive is quite simple, as the component inherits all the code from the directive using OOP. The Component code is actually quite simple.
They are marked as standalone, following the latest Angular trends. This is completely transparent and compatible for code bases still using Angular modules.
The PR also resolves some strange code patterns, such as the use of an empty template in the controller: template: '<ng-template></ng-template>'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I separated the
Editorcomponent logic into a directive and a component that inherits from it.With this change, the directive can be directly attached to a host element like a
textareawithout having to create custom nodes.Example:
It should be compatible with all previous implementations, as the component have the same inputs and outputs as it used to have, and the directive has mostly the same API as the component, except for the
idandtagNameinputs.